<?php 
    require './configs/config.php';
    
   function mvc_autoload($classname){
        if (file_exists("./models/{$classname}.class.php")) {
            require "./models/{$classname}.class.php";
        } elseif (file_exists("./controllers/{$classname}.class.php")) {
            require "./controllers/{$classname}.class.php";
        } else {
             echo '<h1>404 NOT FOUND: </h1>';
             die;
        }
            
   }
   require './libs/Smarty.class.php';
   spl_autoload_register("mvc_autoload");
   
    //接受参数
    $c = empty($_GET['c'])?"Index":$_GET['c'];
    $a = empty($_GET['a'])?"index":$_GET['a'];
    //拼接类名
    $className = $c."Controllers";

    $controllers = new $className();
    $controllers->$a();










